package com.digital.smartgrow.service.title;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.digital.smartgrow.dao.title.ResultsMapper;
import com.digital.smartgrow.dto.title.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
public class ResultServiceImpl implements ResultService{



    @Autowired
    ResultsMapper resultsMapper;

    @Override
    @Transactional
    public List<Results> findList(Results results) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("status", 0);
        queryWrapper.eq("idcard", results.getIdcard());
        return resultsMapper.selectList(queryWrapper);
    }

    @Override
    @Transactional
    public void delete(Results results) {
        Results results1 = new Results();
        Date date = new Date();
        results1.setStatus(1).setId(results.getId()).setTime(date);
        resultsMapper.updateById(results1);
    }
}
